package api

import (
	"fmt"
	"gateway-api/basic/config"
	__ "gateway-api/basic/proto"
	"gateway-api/handler/request"
	"github.com/gin-gonic/gin"

	"net/http"

)

func PackageList(c *gin.Context) {
	var param request.PackageList
	if err := c.ShouldBind(&param); err != nil {
		c.JSON(http.StatusBadRequest, gin.H{
			"code": 400,
			"mes":  "参数错误",
		})
		return
	}
		r, err := config.UserCline.PackageList(c, &__.PackageListReq{
			Page:     param.Page,
			PageSize: param.PageSize,
		})
		if err != nil {
			c.JSON(http.StatusBadRequest, gin.H{
				"code": 400,
				"mes":  err.Error(),
			})
			return
		}
		c.JSON(http.StatusOK, gin.H{
			"code": 200,
			"mes":  "套餐展示成功",
			"data": r,
		})
		return
	}
}
